package cn.fl.capital.transform;

import java.util.ArrayList;
import java.util.List;

import cn.fl.capital.dto.CapAdvBatchDTO;
import cn.fl.capital.vo.CapAdvBatchVO;
import cn.cmm.base.framework.utils.CollectionUtils;

 /**
 * @Description: 垫款批次表 转换器
 * VO是客户端传递数据到服务端进行转换的数据 
 * VO转换数据变成DTO传递到服务端 
 * VO不能在服务端出现
 */
public class CapAdvBatchVOTransform {


	/**
	 * DTO 转  VO
	 * @param dto CapAdvBatchDTO
	 * @return CapAdvBatchVO
	 */
	public static CapAdvBatchVO toVO(CapAdvBatchDTO dto) {
		CapAdvBatchVO  vo = null;
		if (dto != null) { 
			vo = new CapAdvBatchVO();
			vo.setId(dto.getId());
			vo.setBatchNo(dto.getBatchNo());//批次号（流水号）
			vo.setAdvRuleId(dto.getAdvRuleId());//垫款规则ID（垫款规则表ID）
			vo.setAdvTtlAmt(dto.getAdvTtlAmt());//垫款/核销总金额
			vo.setAdvTypCd(dto.getAdvTypCd());//垫款/核销类型1.垫款2.冲销
			vo.setAdvWayCd(dto.getAdvWayCd());//垫款/核销方式CAP0037：1.自动 2.手动
            vo.setSendStsCd(dto.getSendStsCd());
			vo.setCrtTm(dto.getCrtTm());//创建时间
			vo.setCrtUsrId(dto.getCrtUsrId());//创建人
            vo.setCrtUsrNm(dto.getCrtUsrName());
			vo.setMdfTm(dto.getMdfTm());//修改时间
			vo.setMdfUsrId(dto.getMdfUsrId());//修改人
            vo.setRuleNm(dto.getRuleNm());
            vo.setAdvTypCdNm(dto.getAdvTypCdNm());
            vo.setAdvWayCdNm(dto.getAdvWayCdNm());
            vo.setOvdAmounts(dto.getOvdAmounts());
            vo.setOvdDays(dto.getOvdDays());
		}
		return vo;
	}

	/**
	 * VO 转 DTO
	 * @param vo CapAdvBatchVO
	 * @return CapAdvBatchDTO
	 */
	public static CapAdvBatchDTO toDTO(CapAdvBatchVO vo) {
		CapAdvBatchDTO dto = null;
		if (vo != null) {
			dto = new CapAdvBatchDTO();
			dto.setId(vo.getId());
			dto.setBatchNo(vo.getBatchNo());//批次号（流水号）
			dto.setAdvRuleId(vo.getAdvRuleId());//垫款规则ID（垫款规则表ID）
			dto.setAdvTtlAmt(vo.getAdvTtlAmt());//垫款/核销总金额
			dto.setAdvTypCd(vo.getAdvTypCd());//垫款/核销类型1.垫款2.冲销
			dto.setAdvWayCd(vo.getAdvWayCd());//垫款/核销方式CAP0037：1.自动 2.手动
			dto.setSendStsCd(vo.getSendStsCd());
			dto.setCrtTm(vo.getCrtTm());//创建时间
			dto.setCrtUsrId(vo.getCrtUsrId());//创建人
			dto.setMdfTm(vo.getMdfTm());//修改时间
			dto.setMdfUsrId(vo.getMdfUsrId());//修改人
		}
		return dto;
	}
	
	/**
	 * DTO集合 转 VO集合
	 * @param list List<CapAdvBatch>
	 * @return List<CapAdvBatchDTO>
	 */
	public static List<CapAdvBatchVO> toVOList(List<CapAdvBatchDTO> list) {
		List<CapAdvBatchVO>  voList = new ArrayList<CapAdvBatchVO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (CapAdvBatchDTO dto : list) {
				voList.add(toVO(dto));
			}
		}
		return voList;
	}
	
	/**
	 *  VO集合 转 DTO集合
	 * @param list List<CapAdvBatchVO>
	 * @return List<CapAdvBatchDTO>
	 */
	public static List<CapAdvBatchDTO> toDTOList(List<CapAdvBatchVO> list) {
		List<CapAdvBatchDTO>  dtoList = new ArrayList<>();
		if(CollectionUtils.isNotEmpty(list)){
			for (CapAdvBatchVO vo : list) {
				dtoList.add(toDTO(vo));
			}
		}
		return dtoList;
	}
}
